package com.yixq.admin.controller.pay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yixq.admin.controller.dwz.DWZ;
import com.yixq.admin.controller.dwz.DwzAjax;
import com.yixq.soa.service.user.service.RpPayProductService;
import com.yixq.soa.service.user.vo.RpPayProductVo;
import com.yixq.soa.service.web.utils.PageParam;

/**
 * 支付产品管理
 * 
 * @ClassName: PayProductController
 * @Description:
 * @author xiaoqun.yi yixq@doordu.com
 * @date 2017年3月27日 下午3:49:43
 */
@Controller
@RequestMapping("/pay/product")
public class PayProductController {

	@Autowired
	private RpPayProductService rpPayProductService;

	/**
	 * 函数功能说明 ： 查询分页
	 * 
	 * @参数： @return
	 * @return String
	 * @throws
	 */
	@RequestMapping(value = "/list", method = { RequestMethod.POST,
			RequestMethod.GET })
	public String list(RpPayProductVo rpPayProductVo, PageParam pageParam,
			Model model) {
		PageList<RpPayProductVo> pageBean = rpPayProductService.getRpPayProductVoListByAuditStatus("NO", pageParam.getPageBounds());
		model.addAttribute("pageBean", pageBean);
		model.addAttribute("pageParam", pageParam);
		model.addAttribute("rpPayProduct", rpPayProductVo);
		return "pay/product/list";
	}

	/**
	 * 函数功能说明 ：跳转添加
	 * 
	 * @参数： @return
	 * @return String
	 * @throws
	 */
	@RequestMapping(value = "/addUI", method = RequestMethod.GET)
	public String addUI() {

		return "pay/product/add";
	}

	/**
	 * 函数功能说明 ： 保存
	 * 
	 * @参数： @return
	 * @return String
	 * @throws
	 */
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public String add(Model model, RpPayProductVo rpPayProductVo, DwzAjax dwz) {
		rpPayProductService.insert(rpPayProductVo);
		dwz.setMessage(DWZ.SUCCESS_MSG);
		model.addAttribute("dwz", dwz);
		return DWZ.AJAX_DONE;
	}

	


}
